package com.bedpotato.socket.echo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;


public class AdminClient {

	public static void main(String args[]) {
		Socket socket = null;
		int port = 10001;

		try {
			socket = new Socket("localhost", port);
			OutputStream out = socket.getOutputStream();
			out.write("shutdown\r\n".getBytes());
			BufferedReader br = new BufferedReader(new InputStreamReader(
					socket.getInputStream()));
			String msg = br.readLine();
			System.out.println(msg);
		} catch (UnknownHostException e) {

			e.printStackTrace();
		} catch (IOException e) {

			e.printStackTrace();
		} finally {

			try {
				if (socket != null)
					socket.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

	}
}